<template>
	<view class="wrap">
		<view class="care-all">
			<view class="cate-section">
				<view class="cate-item">
					<image src="/static/images/project_nav_001.png"></image>
					<text>项目入库</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_002.png"></image>
					<text>项目评估</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_003.png"></image>
					<text>项目核查</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_004.png"></image>
					<text>项目再评估</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_005.png"></image>
					<text>商务谈判</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_006.png"></image>
					<text>合同签署</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_007.png"></image>
					<text>公司登记</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_008.png"></image>
					<text>项目供地</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_109.png"></image>
					<text>项目建设</text>
				</view>
				<view class="cate-item">
					<image src="/static/images/project_nav_110.png"></image>
					<text>投后服务</text>
				</view>
			</view>
		</view>	
		<view class="tabbar-box">
			<tab-bar :counts="navCounts" :current="navCurrent" @onChange="onNavBarChange"></tab-bar>
		</view>
		
		<tab-page-one v-if="navCurrent===0" :pageData='pageData'></tab-page-one>
		<tab-page-two v-else-if="navCurrent===1" :pageData='pageData'></tab-page-two>
		<tab-page-the v-else :pageData='pageData'></tab-page-the>
		<view class="fixed-action-bar">
			<view class="item" @click="handleEdit">
				<view class="btn-box">
					<image src="../../../static/images/icon_edit.png" mode="widthFix" class="icon"></image>
					<text class="text-edit">编辑</text>
				</view>
			</view>
			<view class="item" @click="handleDelete">
				<view class="btn-box">
					<image src="../../../static/images/icon_del.png" mode="widthFix" class="icon"></image>
					<text class="text-delete">删除</text>
				</view>
			
			</view>
		</view>
	</view>
</template>

<script>
	import tabBar from '../components/tab-bar.vue';
	import tabPageOne from './components/tab-page-one.vue'
	import tabPageTwo from './components/tab-page-two.vue'
	import tabPageThe from './components/tab-page-the.vue'
	export default {
		components:{
			tabBar,
			tabPageOne,
			tabPageTwo,
			tabPageThe
		},
		data() {
			return {
				navCounts: [], //订单数量
				navs: [
					{name: '本周报送'},
					{name: '本季跟进'},
					{name: '本季跟进'},
				],
				navCurrent: 0, //当前tab
				upOption:{
					page: {
					 	num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
					 	size: 10 // 每页数据的数量
					},
					noMoreSize: 3, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
				},
				
				code:'code',//项目主键
				pageData:{},//详情数据
			}
		},
		methods: {
			handleEdit(){
				console.log(this.code)
				const path = `/pages/projectManerge/edit/edit`
				console.log(path)
				uni.navigateTo({
					url:path
				})
				
			},
			handleDelete(){
				console.log('delete')
				uni.showModal({
					title:"确认删除吗"
				})
			},
			//tab切换
			onNavBarChange(current){
				console.log(current,"~~~~~~~~~")
				if(this.navCurrent === current){
					return;
				}
				this.navCurrent = current;
				this.refreshList();
			},
			refreshList(){
				
			},
			
			async getDetailData(code){
				const res  =await this.$req({
					url:`bus/proj/view.do`,
					method:'GET',
					data:{
						dataKey:code	
					}
				})
				if(res.data.success){
					this.pageData=res.data.attributes
				} else {
					uni.showToast({
						title:res.data.message,
						icon:'none'
					})
				}	
			}
		},
		onLoad(options) {
			console.log(options.code,"~~~~~~~~~~~~~code~~~~~~~~~~~~~~~~")
			this.code = options.code
			this.getDetailData(options.code)
		}
	}
</script>

<style lang="scss" scoped>
	.wrap{
		padding-bottom: 60rpx;
	}
	page{
		padding-bottom: 20rpx;
	}

	.fixed-action-bar{
		width: 100%;
		display: flex;
		height: 70rpx;
		align-items: center;
		background: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 999;
		.item{
			width: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
			
		}
		.icon{
			width: 30rpx;
		}
		.btn-box{
			width: 90rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 70rpx;
		}
		.text-edit{
			font-size: 24rpx;
			color: #0099cc;
			line-height: 70rpx;
		}
		.text-delete{
			font-size: 24rpx;
			color: #cc3357;
			line-height: 70rpx;
		}
	}
	
	
	.tabbar-box{
		width: 750rpx;
		height: 70rpx;
		margin-top: 10rpx;
	}
	.care-all{
		height: 230rpx;
		// padding-top: 22rpx;
		padding: 22rpx 34rpx 0 34rpx;
		background: #fff;
		.cate-section {
			width:682rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			flex-wrap:wrap;
			
			.cate-item {
				width: 20%;
				display: flex;
				flex-direction: column;
				align-items: center;
				font-size:26rpx;
				color: #303133;
				margin-bottom: 20rpx;
			}
			image {
				width: 50rpx;
				height: 50rpx;
				margin-bottom: 10rpx;
				// border-radius: 50%;
			}	
		}
	}
</style>
